import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:'/index'
  },
  {
    path: '/index',
    name: 'Index',
    component: () => import('../views/Index.vue'),
    redirect:'/home',
    children:[
      {
        path: '/home',
        name: 'home',
        component: () => import('../views/home.vue')
      },
      {
        path: '/cate',
        name: 'cate',
        component: () => import('../views/cate.vue')
      },
      {
        path: '/cart',
        name: 'cart',
        component: () => import('../views/cart.vue')
      },
      {
        path: '/my',
        name: 'my',
        component: () => import('../views/my.vue')
      }
    ]
  },
  {
    path: '/about',
    name: 'about',
    component: () => import('../views/AboutView.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
